﻿<UserControl x:Class="Starehe.Views.StaffList"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:Controls="clr-namespace:Helper.Controls;assembly=Helper"
      xmlns:local="clr-namespace:Starehe"
      mc:Ignorable="d" 
      d:DesignHeight="548" d:DesignWidth="984"
             Background="White">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Starehe;component/ModelsDataTemplates.xaml"/>                
            </ResourceDictionary.MergedDictionaries>
            <SolidColorBrush x:Key="TitleBackgroundBrush" Color="{DynamicResource Title2BackgroundColor}"/>
            <Style x:Key="dt" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                <EventSetter Event="ListBoxItem.MouseDoubleClick" Handler="OnDoubleClick" />
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" HorizontalAlignment="Left" Margin="20,20,0,0" Style="{DynamicResource Title}"  Text="Staff List" VerticalAlignment="Top"/>
        <TextBox Style="{StaticResource SearchTextBox}" Grid.Row="0"  Name="txtTitle" HorizontalAlignment="Left" Height="23" Margin="230,26,0,0" 
                 Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged, Delay=10, Mode=OneWayToSource}" VerticalAlignment="Top" Width="454"/>
        <TextBlock Grid.Row="0"  HorizontalAlignment="Right" Margin="0,10,10,0" VerticalAlignment="Top" >
                <Hyperlink Command="{Binding RefreshCommand}">Refresh</Hyperlink>
        </TextBlock>
        <ListBox Style="{StaticResource tabListBox}" Grid.Row="1" Margin="20,0,20,20" ItemTemplate="{StaticResource StaffListTemplate}" 
                 ItemsSource="{Binding CollViewSource.View, IsAsync=True}"
                 ItemContainerStyle="{StaticResource dt}">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <Controls:VirtualizingWrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</UserControl>
